<?php
session_start(); include_once 'data/usercheck.php'; ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<title>Food Online</title>
	<link rel="stylesheet" href="style.css" type="text/css" charset="utf-8" />
</head>
<body>
  <div id="wrapper">
    <div id="logo">
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <table width="200" border="0" align="center">
    <tr>
      <td height="30"><FONT size="+6">
        <div align="center">STMS</div></td>
    </tr>
    <tr>
      <td><div align="center">STUDENT MANAGEMENT SYSTEM</div></td>
    </tr>
</table>
  <p>&nbsp;</p>
</div>
    <div id="nav">
      <div id="nav-left">
        <ul>
          <li><a href="HometoAdmin.php">Home</a></li>
          <li class="orange">
            <div align="left"><a href="http://localhost/stms/pages/data/logout.php">Logout-<?php include_once 'data/databaseconnection.php';session_start();echo $_SESSION['username'];?></a></div>
          </li>
        </ul>
      </div>
      <div id="nav-right">
        <ul>
         
          <li><a href="Aboutus.php">About us</a></li>
          <li><a href="viewhome.php">Student</a></li>
          <li><a href="Adminhome.php">Admin</a></li>
          <li><a href="http://studentmanagements.blogspot.com/">Contact</a></li>
        </ul>
      </div>
    </div>
    <div id="body">
      <div align="right">
        <div align="left">
          <div align="left">
            <table width="751" border="0">
              <tr>
                <td width="96" height="23"><span class="clear"><font size="+1"><a href="showadmin.php">Basicdetails</a></font></span></td>
                <td width="79"><span class="clear"><font size="+1"><a href="aladmin.php">A/Ldetails</a></font></span></td>
                <td width="101"><span class="clear"><font size="+1"><a href="compinadmin.php">Combination</a></font></span></td>
                <td width="58"><span class="clear"><font size="+1"><a href="courseadmin.php">Course</a></font></span></td>
                <td width="51"><span class="clear"><font size="+1"><a href="Resultadmin.php">Result</a></font></span></td>
                <td width="92"><font size="+1"><a href="changepass.php"><span class="clear"><font size="+1"></font></span></a><span class="clear"><font size="+1"><a href="attendadmin.php">Attendance</a></font></span></font></td>
                <td width="244"><div align="right"><font size="+1"><a href="changepass.php">changepassword</a></font></div></td>
              </tr>
            </table>
          </div>
        </div>
      </div>
      <p>&nbsp;      </p>
      <p>
         <?php
        if (isset($_GET['err'])) {
            $err = $_GET['err'];
            echo '<span  style="color:  #F4C389"  >'.$err.'</span>';
			}
	
        if (isset($_GET['err1'])) {
            $err1 = $_GET['err1'];
			$delimiter = ".";
			$items = explode($delimiter, $err1);
			$a=$items[0];
			$b=$items[1];
			$sql=mysql_query("select * from results where Regno='$a' and SubjectCode='$b'");
			while($row=mysql_fetch_array($sql))
			{
				$reg=$row['Regno'];
				$in=$row['Indexno'];
				$co=$row['SubjectCode'];
				$gr=$row['Grade'];
				
			}
        }
        ?>
      </p>
      <form id="form1" method="post" action="data/resultcheck.php">
        <p><font size="-1">
          <marquee direction="left">
            The Regno and SubjectCode is must for the changes
        </marquee>
        </font></p>
<table width="744" border="0">
        <tr>
            <td width="361" rowspan="2"><table width="314" border="0">
              <tr>
                <td height="34"><font size="-1">Regno</font></td>
                <td><input type="text" name="Regno" id="Regno" value="<?php echo $reg; ?>" placeholder="2009/SP/004" pattern="[0-9]{4}/[A-Z]{2}/[0-9]{3}"/></td>
              </tr>
			  <tr>
                <td height="34"><font size="-1">Indexno</font></td>
                <td><input type="text" name="Indexno" id="Indexno" value="<?php echo $in; ?>"/></td>
              </tr>
              <tr>
                <td height="32"><label for="SubjectCode"><font size="-1">SubjectCode</font></label></td>
                <td><label for="SubjectCode"></label>
                  <select name="SubjectCode" id="SubjectCode">
				  <?php
				  $result=mysql_query("SELECT * FROM course");
				  while($row=mysql_fetch_array($result))
				  {
				  echo "<option value='".$row['SubjectCode']."'>".$row['SubjectCode']."</option>";

				  }
				  ?>
                </select></td>
              </tr>
              <tr>
                <td height="38"><font size="-1">Grade</font></td>
                <td><label for="Grade"></label>
                  <select name="Grade" id="Grade">
				  <?php
				  $result=mysql_query("SELECT * FROM grade");
				  while($row=mysql_fetch_array($result))
				  {
				  echo "<option value='".$row['Grade']."'>".$row['Grade']."</option>";

				  }
				  ?>
                </select></td>
              </tr>
            </table></td>
            <td width="27" rowspan="2">&nbsp;</td>
            <td width="334"><label for="Search">Search</label>
              <input type="text" name="Searcher" id="Search"  />
            <input type="submit" name="Search2" id="Search3" value="Search" /></td>
          </tr>
          <tr>
            <td><?php
			
			if(isset($_GET['err2'])) 
		{
		
		
		 $err2 = $_GET['err2'];
		 $result=mysql_query("SELECT * FROM results WHERE Regno='$err2' OR Indexno='$err2'");
		 
		 require_once 'data/databaseconnection.php';
			echo "<table border=1>";
			echo "<tr>";
			echo "<th>Regno</th>";
			echo "<th>Indexno</th>";
			echo "<th>SubjectCode</th>";
			echo "<th>Grade</th>";
			
			
			//$result=mysql_query("SELECT * FROM results");
			while($row=mysql_fetch_array($result))
			{
				echo "<tr><td>".$row['Regno'];
				echo "<td>".$row['Indexno'];
				echo "<td>".$row['SubjectCode'];
				echo "<td>".$row['Grade'];
				
			}
			echo "</table>";
		 
		}
		else
		{
		  require_once 'data/databaseconnection.php';
			echo "<table border=1>";
			echo "<tr>";
			echo "<th>Regno</th>";
			echo "<th>Indexno</th>";
			echo "<th>SubjectCode</th>";
			echo "<th>Grade</th>";
			
			
			$result=mysql_query("SELECT * FROM results");
			while($row=mysql_fetch_array($result))
			{
				echo "<tr><td>".$row['Regno'];
				echo "<td>".$row['Indexno'];
				echo "<td>".$row['SubjectCode'];
				echo "<td>".$row['Grade'];
				
			}
			echo "</table>";
			}
		  ?></td>
          </tr>
        </table>
        <p>&nbsp;</p>
        <p>&nbsp;</p>
        <table width="264" border="0">
          <tr>
            <td width="80"><div align="center">
              <input type="submit" name="ADD" id="ADD" value="Add" />
            </div></td>
            <td width="84"><div align="center">
              <input type="submit" name="UPDATE" id="UPDATE" value="Update" />
            </div></td>
            <td width="86"><div align="center">
              <input type="submit" name="DELETE" id="DELETE" value="Delete" />
            </div></td>
			            <td width="98"><input type="submit" name="Search" id="Search2" value="Search" /></td>

          </tr>
        </table>
        <p>&nbsp;</p>
      </form>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <div class="clear">&nbsp;</div>
      <div id="footer">
        <ul>
          <li><a href="HometoAdmin.php">Home</a> | </li>
          <li><a href="Aboutus.php">About Us</a> | </li>
          <li></li>
          <li><a href="http://studentmanagements.blogspot.com/">Contact</a></li>
        </ul>
        <p>copyright &copy;STMS Group03</p>
      </div>
    </div>
  </div>
</body>
</html>
